#pragma once
#ifndef MAP_LOADER_H
#define MAP_LOADER_H

#include <string>
#include <vector>
#include <Box2D.h>
#include <SFML/Graphics.hpp>
#include "MapData.h"

struct MapInfo {

	std::vector<sf::Sprite> sprites;

	std::vector<b2EdgeChainDef> bounds;
};

class MapLoader
{
public:
	
	MapInfo loadMapInfo(const std::string& dirName);

private:

	std::vector<sf::IntRect> getRects(const MapData& mapData);

	sf::Vector2f mapToWorld(const int& row, const int& col, const MapData& mapData);

	void parseShape(std::vector<b2EdgeChainDef>* shapes, const int& row, const int& col, const short& boundValue, short* lastBound);

};

#endif //MAP_LOADER_H
